<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>合同管理</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro/easyui.css">
<style type="text/css">
	a{
		text-decoration:none;
	}
	ul li{
		list-style: none;
	}
	.hetong-xq{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	.qianding-ht{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	/* 表格上面搜索框旁边的按钮 */
	#select-qb{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	#select-zz{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	#select-lz{
		color: red;
		border:1px solid #1AB394;
	}
</style>
</head>
<body>
<script type="text/javascript">
		/* 合同编辑窗口 */
		function condeittcontract(contreact_id){
			alert(contreact_id);
			//初始化表单
			$("#htbj-form").form('load','contract-bjsj?contreact_id='+contreact_id);
			$("#contract-bianji").window("open");	
			
			$("#contractbj-gb").linkbutton({onClick : function(){
				$("#contract-bianji").window("close");
			}});
		}	
		function qiandinghetong(contreact_id){
			alert(contreact_id);
			$("#qdform").form('load','contract-bjsj?contreact_id='+contreact_id);
			$("#qiandhetong").window("open");	
			$("#contractqd-gb").linkbutton({onClick : function(){
				$("#qiandhetong").window("close");
			}});
		}	
		$(function(){
			$('#contract-table').datagrid({
			    url:'contractaaaaa',
			    columns:[[
					{field:'Contreact_id',checkbox:true,title:'合同编号',width:100,align:'center'},
					{field:'staff_id',title:'员工编号',width:150,align:'center'},
					{field:'Staff_name',title:'员工名称',width:150,align:'center'},
					{field:'Contract_Desc',title:'合同描述',width:150,align:'center'},
					{field:'Contract_TypeName',title:'合同类别',width:150,align:'center'},
					{field:'EndDate',title:'开始日期',width:150,align:'center'},
					{field:'StartDate',title:'结束日期',width:150,align:'center'},
					{field:'TryEndDate',title:'试用期结束日期',width:150,align:'center'},
					{field:'Staff_sfzz',title:'是否在职',width:150,align:'center'},
					{field:'Contreact_qdstate',title:'签订状态',width:150,align:'center'},
					{field:'Remarks',title:'备注',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:250,align:'center',
						formatter: function(value,row,index){
							return "<input type='button' onclick='condeittcontract("+row['Contreact_id']+")' style='width: 45px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>"+"<input type='button' onclick='qiandinghetong("+row['Contreact_id']+")' style='width: 80px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='点击确定签订'/>";
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			
			//签订审核ajax
			$("#contreact-qianding").linkbutton({onClick : function(){
				alert($("#contreact_id").textbox("getValue"));
				  $.ajax({
			         type:"post",//type可以为post也可以为get
			         url:"qd-contract",
			         data:{contreact_id:$("#contreact_id").textbox("getValue")
			        	   },
			         success:function(data){
			        	 $("#contract-table").datagrid("reload");
			             $("#qiandhetong").window("close");
			         }
			     });
				
			}});  
			
			
			/* 编辑确定 */
			$("#qd-contreact").click(function(){
				$("#htbj-form").submit();
				$("#htbj-form").form("clear");
				$("#contract-bianji").window("close");
			});
			 //打印机
			/* $("#dayin").linkbutton({onClick : function(){
				$("#contractiid").html($("#contreact_id").textbox("getValue"));
				$("#dayin-window").window("open");	
			}});
			//打印成图片报表
			$(document).ready(function(){
				$('#dayinanniu').linkbutton({onClick :function(){
					$('.dayin-contract').printArea();
				}});
			});  */
		});
		//条件查询
		function qq(contract_TypeName,name){
			alert(contract_TypeName);
			$("#contract-table").datagrid({
	    		url:'select-contract',
	    		queryParams:{
	    			contract_TypeName:contract_TypeName
	    			
	    		},
	    		//初始化表格
	    		columns:[[
	    			{field:'Contreact_id',checkbox:true,title:'合同编号',width:100,align:'center'},
					{field:'staff_id',title:'员工编号',width:150,align:'center'},
					{field:'staff_name',title:'员工名称',width:150,align:'center'},
					{field:'contract_Desc',title:'合同描述',width:150,align:'center'},
					{field:'contract_TypeName',title:'合同类别',width:150,align:'center'},
					{field:'endDate',title:'开始日期',width:150,align:'center'},
					{field:'startDate',title:'结束日期',width:150,align:'center'},
					{field:'tryEndDate',title:'试用期结束日期',width:150,align:'center'},
					{field:'staff_sfzz',title:'是否在职',width:150,align:'center'},
					{field:'Contreact_qdstate',title:'签订状态',width:150,align:'center'},
					{field:'remarks',title:'备注',width:150,align:'center'},
	    			{field:'caozuo',title:'操作',width:100,align:'center',
	    				formatter: function(value,row,index){
						return "<input type='button' onclick='condeittcontract("+row['Contreact_id']+")' style='width: 45px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>";
					},
	    		}
	    	]],
	    	pagination:true,
	    	pageNumber:1,
	    	pageSize:5,
	    	pageList:[5,10,15]
	    	});
			function qb(contract_TypeName,name){
				alert(contract_TypeName);
				$("#contract-table").datagrid({
		    		url:'select-contractb',
		    		queryParams:{
		    			contract_TypeName:contract_TypeName
		    			
		    		},
		    		//初始化表格
		    		columns:[[
		    			{field:'Contreact_id',checkbox:true,title:'合同编号',width:100,align:'center'},
						{field:'staff_id',title:'员工编号',width:150,align:'center'},
						{field:'staff_name',title:'员工名称',width:150,align:'center'},
						{field:'contract_Desc',title:'合同描述',width:150,align:'center'},
						{field:'contract_TypeName',title:'合同类别',width:150,align:'center'},
						{field:'endDate',title:'开始日期',width:150,align:'center'},
						{field:'startDate',title:'结束日期',width:150,align:'center'},
						{field:'tryEndDate',title:'试用期结束日期',width:150,align:'center'},
						{field:'staff_sfzz',title:'是否在职',width:150,align:'center'},
						{field:'Contreact_qdstate',title:'签订状态',width:150,align:'center'},
						{field:'remarks',title:'备注',width:150,align:'center'},
		    			{field:'caozuo',title:'操作',width:100,align:'center',
		    				formatter: function(value,row,index){
							return "<input type='button' onclick='condeittcontract("+row['Contreact_id']+")' style='width: 45px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>";
						},
		    		}
		    	]],
		    	pagination:true,
		    	pageNumber:1,
		    	pageSize:5,
		    	pageList:[5,10,15]
		    	});
			//签订审核ajax
			$("#contreact-qianding").linkbutton({onClick : function(){
				alert($("#contreact_id").textbox("getValue"));
				  $.ajax({
			         type:"post",//type可以为post也可以为get
			         url:"qd-contract",
			         data:{contreact_id:$("#contreact_id").textbox("getValue")
			        	   },
			         success:function(data){
			        	 $("#contract-table").datagrid("reload");
			             $("#qiandhetong").window("close");
			         }
			     });
				
			}); 

</script>
	<a id="add" class="easyui-linkbutton">新增合同</a>
	    <input id="zxrec" class="easyui-searchbox" style="width:300px"
	    data-options="searcher:qq,prompt:'根据合同类型,员工名称'">
	<a id="dayin" href="#" class="easyui-linkbutton"  data-options="iconCls:'icon-print',plain:true" style="width:80px;">打印</a>
	<!-- 表格 -->
	<table id="contract-table" class="easyui-datagrid" style="height: 560px;">   
	</table>  
	
	<!-- 详情页面 -->
	<div id="contract-bianji" class="easyui-window" title="详情" style="width:800px;height:300px;" 
		data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closed:true,draggable:false">
			<Form  action="xiugai-contract" id="htbj-form" method="post">
		        	<table width="600px" style="padding: 5px 5px 2px 3px;height:130px;">
		        		<tr>
		        			<td><input  name="contreact_id" class="easyui-textbox" data-options="label:'合同编号',width:280,labelAlign:'right',required:true"/></td>
		        			<td><input  name="endDate" class="easyui-datebox" data-options="label:'合同开始日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        		</tr>
		        		<tr>
		        			<td><select name="contract_TypeName"  class="easyui-combobox"  data-options="label:'合同类型',width:280,labelAlign:'right',required:true">   
	    							<option>劳动合同</option>   
	    							<option>实习合同</option>
	    							<option>劳务合同</option> 
	    							<option>其他合同</option>      
							</select></td>
		        			<td><input name="startDate" class="easyui-datebox"  data-options="label:'合同结束日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        		</tr>
		        		<tr>
		        			<td><input  name="tryEndDate" class="easyui-datebox" data-options="label:'试用期结束日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        			<td><input name="contract_Desc" class="easyui-textbox" data-options="label:'合同描述',width:280,labelAlign:'right',required:true"/></td>
						</tr>
		        		<tr>
		        			<td><input  name="remarks" class="easyui-textbox"  data-options="label:'备注',width:280,labelAlign:'right',required:true"/></td>
		        		</tr>
		        	</table>
		        	<div style="text-align: center;margin: 10px 1px 1px 1px">
					<a id="contractbj-gb" class="easyui-linkbutton" data-options="width:100">关闭</a>
					<a id="qd-contreact"  class="easyui-linkbutton" data-options="width:100">确定</a>
					</div>
				 </Form>
		</div>
	
	<!-- 签订合同 -->
	<div id="qiandhetong" class="easyui-window" title="详情" style="width:800px;height:300px;" 
		data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closed:true,draggable:false">
			<Form  action="" id="qdform" method="post">
		        	<table width="600px" style="padding: 5px 5px 2px 3px;height:130px;">
		        		<tr>
		        			<td><input id="contreact_id"  name="contreact_id" class="easyui-textbox" data-options="label:'合同编号',width:280,labelAlign:'right',required:true"/></td>
		        			<td><input  name="endDate" class="easyui-datebox" data-options="label:'合同开始日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        		</tr>
		        		<tr>
		        			<td><select name="contract_TypeName"  class="easyui-combobox"  data-options="label:'合同类型',width:280,labelAlign:'right',required:true">   
	    							<option>劳动合同</option>   
	    							<option>实习合同</option>
	    							<option>劳务合同</option> 
	    							<option>其他合同</option>      
							</select></td>
		        			<td><input name="startDate" class="easyui-datebox"  data-options="label:'合同结束日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        		</tr>
		        		<tr>
		        			<td><input  name="tryEndDate" class="easyui-datebox" data-options="label:'试用期结束日期',width:280,labelAlign:'right',required:true,editable:false"/></td>
		        			<td><input name="contract_Desc" class="easyui-textbox" data-options="label:'合同描述',width:280,labelAlign:'right',required:true"/></td>
						</tr>
		        		<tr>
		        			<td><input  name="remarks" class="easyui-textbox"  data-options="label:'备注',width:280,labelAlign:'right',required:true"/></td>
		        			<td><input id="contreact_qdstate"  name="contreact_qdstate" class="easyui-textbox"  data-options="label:'签订状态',width:280,labelAlign:'right',required:true"/></td>
		        		</tr>
		        	</table>
		        	<div style="text-align: center;margin: 10px 1px 1px 1px">
					<a id="contractqd-gb" class="easyui-linkbutton" data-options="width:100">取消</a>
					<a id="contreact-qianding"  class="easyui-linkbutton" data-options="width:100">确定签订此合同</a>
					</div>
				 </Form>
		</div>
	<!--< div id="dayin-window" class="easyui-window" title="打印" style="width:800px;height:450px;" 
		data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closed:true">
			<div style="float: right;">
					<a id="dayinanniu" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true",style="width:80px;">打印</a>
			</div>
			<div style="font-size: 14px;font-weight: bold;padding: 5px">%%%公司</div><hr style="border: 0px ;border: 1px dashed #D9E0EB"/>
			<div class="easyui-layout dayin-contract" data-options="fit:true">
				<div data-options="region : 'center' , split : true" style="height:50px">
					<div>
						<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" width="100%">
							<thead>
								<tr style="text-align: center">
									<td style="font-size: 20px;font-weight: bold;text-align: center;color: #398000;" rowspan="1" colspan="2">合同打印单</td>
									<td style="height:23px;width:90px">
									合同编号：
									</td>
									<td style="height:23px;width:150px" id="contractiid">
									
									</td>
									<td style="height:23px;width:90px">
									员工名称：
									</td>
									<td style="height:23px;width:150px" id="yuangongname">
									
									</td>
									<td style="height:23px;width:90px">
									合同类别：
									</td>
									<td style="height:23px;width:150px" id="contract-typename">
									
									</td>
								</tr>
								<tr style="text-align: center">
									<td style="height:23px;width:90px">
									合同描述：
									</td>
									<td style="height:23px;width:150px" id="contract-desc">
									
									</td>
									<td style="height:23px;width:90px">
									开始日期：
									</td>
									<td style="height:23px;width:150px" id="start-riqi">
									
									</td>
									<td style="height:23px;width:90px">
									结束日期：
									</td>
									<td style="height:23px;width:150px" id="end-riqi">
									
									</td>
									<td style="height:23px;width:90px">
									试用期结束日期：
									</td>
									<td style="height:23px;width:150px" id="tyeend-riqi">
									
									</td>
									
								</tr>
								<tr style="text-align: center">
								<td style="height:23px;width:90px">
									备注：
									</td>
									<td style="height:23px;width:150px" id="contrac-tbeizhu">
									
									</td>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
		</div> -->
</body>
</html>